{include file="common/head"/}
<div class="admin-main layui-anim layui-anim-upbit" ng-app="hd" ng-controller="ctrl">
    <fieldset class="layui-elem-field layui-field-title">
        <legend>{$title}</legend>
    </fieldset>
    <form class="layui-form layui-form-pane">
        <div class="layui-form-item">
            <label class="layui-form-label">所属用户组</label>
            <div class="layui-input-4">
                <select name="level" lay-verify="required" ng-model="field.level" ng-options="v.level_id as v.level_name for v in group" ng-selected="v.level_id==field.level">
                    <option value="">请选择会员组</option>
                </select>
            </div>
        </div>
       
        <div class="layui-form-item">
            <label class="layui-form-label">{:lang('email')}</label>
            <div class="layui-input-4">
                <input type="text" name="email" ng-model="field.email" lay-verify="eamil" placeholder="输入{:lang('email')}" class="layui-input">
            </div>
            <div class="layui-form-mid layui-word-aux">
                必填：用于找回密码
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">{:lang('tel')}</label>
            <div class="layui-input-4">
                <input type="text" name="mobile" ng-model="field.mobile" lay-verify="mobile" placeholder="输入{:lang('tel')}" class="layui-input">
            </div>
            <div class="layui-form-mid layui-word-aux">
                只能填写数字
            </div>
        </div>
		<div class="layui-form-item">
            <label class="layui-form-label">身份证号：</label>
            <div class="layui-input-4">
                <input type="text" name="shenfenzheng" ng-model="field.shenfenzheng" lay-verify="shenfenzheng" placeholder="请输入身份证号" class="layui-input">
            </div>
            <div class="layui-form-mid layui-word-aux">
                只能填写数字
            </div>
        </div>
		<div class="layui-form-item">
            <label class="layui-form-label">开户行名称：</label>
            <div class="layui-input-4">
                <input type="text" name="bank_name" ng-model="field.bank_name" lay-verify="bank_name" placeholder="请输入银行开户行名称" class="layui-input">
            </div>
            <div class="layui-form-mid layui-word-aux">
                如： 中国农业银行，支付宝可以填支付宝
            </div>
        </div>
		<div class="layui-form-item">
            <label class="layui-form-label">开户行地址：</label>
            <div class="layui-input-4">
                <input type="text" name="bank_dizhi" ng-model="field.bank_dizhi" lay-verify="bank_dizhi" placeholder="请输入银行开户行地址" class="layui-input">
            </div>
            <div class="layui-form-mid layui-word-aux">
                如： 开发区支行
            </div>
        </div>
		 <div class="layui-form-item">
            <label class="layui-form-label">开户姓名:</label>
            <div class="layui-input-4">
                <input type="text" name="username" ng-model="field.username" lay-verify="required" placeholder="{:lang('pleaseEnter')}{:lang('nickname')}" class="layui-input">
            </div>
			 <div class="layui-form-mid layui-word-aux">
               如： 张三
            </div>
        </div>
		<div class="layui-form-item">
            <label class="layui-form-label">开户卡号：</label>
            <div class="layui-input-4">
                <input type="text" name="bank_card" ng-model="field.bank_card" lay-verify="bank_card" placeholder="输入银行账号" class="layui-input">
            </div>
            <div class="layui-form-mid layui-word-aux">
                请输入银行卡号
            </div>
        </div>
		<div class="layui-form-item">
            <label class="layui-form-label">余额</label>
            <div class="layui-input-4">
                <input type="text" name="money_jifen" ng-model="field.money_jifen"  placeholder="余额" class="layui-input">
            </div>
            <div class="layui-form-mid layui-word-aux">
                只能填写数字
            </div>
        </div>
	
<!--		<div class="layui-form-item">
     <label class="layui-form-label">剩余金钱</label>
            <div class="layui-input-4">
                <input type="text" name="money_qian" ng-model="field.money_qian" lay-verify="money_qian" placeholder="剩余金钱" class="layui-input">
            </div>
            <div class="layui-form-mid layui-word-aux">
                只能填写数字
            </div>
        </div>
		
			<div class="layui-form-item">
            <label class="layui-form-label">剩余本金</label>
            <div class="layui-input-4">
                <input type="text" name="money_benjin" ng-model="field.money_benjin" lay-verify="money_benjin" placeholder="剩余本金" class="layui-input">
            </div>
            <div class="layui-form-mid layui-word-aux">
                只能填写数字
            </div>
        </div>
		<div class="layui-form-item">
            <label class="layui-form-label">其他金钱</label>
            <div class="layui-input-4">
                <input type="text" name="money_qita" ng-model="field.money_qita" lay-verify="money_qita" placeholder="其他金钱" class="layui-input">
            </div>
            <div class="layui-form-mid layui-word-aux">
                只能填写数字
            </div>
        </div>-->
		<div class="layui-form-item">
            <label class="layui-form-label">激活码</label>
            <div class="layui-input-4">
                <input type="text" name="money_baodan" ng-model="field.money_baodan" lay-verify="money_baodan" placeholder="其他金钱" class="layui-input">
            </div>
            <div class="layui-form-mid layui-word-aux">
                只能填写数字
            </div>
        </div>
	
        <div class="layui-form-item">
            <label class="layui-form-label">{:lang('pwd')}</label>
            <div class="layui-input-4">
                <input type="password" name="password" placeholder="输入{:lang('pwd')}" class="layui-input">
            </div>
            <div class="layui-form-mid layui-word-aux">
                密码必须大于6位，小于15位
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">报单中心</label>
                <div class="layui-input-block">
					<input type="radio" name="server" ng-model="field.server" ng-checked="field.server==0" ng-value="0" title="不是">
                    <input type="radio" name="server" ng-model="field.server" ng-checked="field.server==2" ng-value="2" title="是">
                   
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">{:lang('qq')}</label>
            <div class="layui-input-4">
                <input type="text" name="qq" ng-model="field.qq" placeholder="输入{:lang('qq')}" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item" style="display: none">
            <label class="layui-form-label">{:lang('address')}</label>
            <div class="layui-input-inline">
                <select name="province" ng-model="field.province" lay-filter="province" ng-options="v.id as v.name for v in province" ng-selected="v.id==field.province">
                    <option value="">请选择省</option>
                </select>
            </div>
            <div class="layui-input-inline" >
                <select name="city" id="city" ng-model="field.city" lay-filter="city" ng-options="v.id as v.name for v in city" ng-selected="v.id==field.city">
                    <option value="">请选择市</option>
                </select>
            </div>
            <div class="layui-input-inline">
                <select name="district" id="district" ng-model="field.district" lay-filter="district" ng-options="v.id as v.name for v in district" ng-selected="v.id==field.district">
                    <option value="">请选择县/区</option>
                </select>
            </div>
        </div>
		<div class="layui-form-item">
            <label class="layui-form-label">详细地址</label>
            <div class="layui-input-4">
                <input type="text" name="dizhi" ng-model="field.dizhi" lay-verify="dizhi" placeholder="请输入详细地址" class="layui-input">
            </div>
            <div class="layui-form-mid layui-word-aux">
                
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button type="button" class="layui-btn" lay-submit="" lay-filter="submit">{:lang('submit')}</button>
                <a href="{:url('index')}" class="layui-btn layui-btn-primary">{:lang('back')}</a>
            </div>
        </div>
    </form>
</div>
{include file="common/foot"/}
<script src="/static/common/js/angular.min.js"></script>
<script>

    var m = angular.module('hd',[]);
    m.controller('ctrl',function($scope) {
        $scope.field = {$info|raw};
        $scope.group = {$user_level|raw};
        $scope.province = {$province|raw};
        $scope.city = {$city|raw};
        $scope.district = {$district|raw};
        layui.use(['form', 'layer'], function () {
            var form = layui.form, layer = layui.layer,$= layui.jquery;
            form.on('select(province)', function(data) {
                var pid = data.value;
                var loading = layer.load(1, {shade: [0.1, '#fff']});
                $.get("{:url('getRegion')}?pid=" + pid, function (data) {
                    layer.close(loading);
                    var html='<option value="">请选择市</option>';
                    $.each(data, function (i, value) {
                        html += '<option value="number:'+value.id+'">'+value.name+'</option>';
                    });
                    $('#city').html(html);
                    $('#district').html('<option value="">请选择县/区</option>');
                    form.render()
                });
            });
            form.on('select(city)', function(data) {
                var pid = data.value;
                var loading = layer.load(1, {shade: [0.1, '#fff']});
                $.get("{:url('getRegion')}?pid=" + pid, function (data) {
                    layer.close(loading);
                    var html='<option value="">请选择县/区</option>';
                    $.each(data, function (i, value) {
                        html += '<option value="number:'+value.id+'">'+value.name+'</option>';
                    });
                    $('#district').html(html);

                    form.render()
                });
            });
            form.on('submit(submit)', function (data) {
                // 提交到方法 默认为本身
                var loading = layer.load(1, {shade: [0.1, '#fff']});
                data.field.id = $scope.field.id;
                $.post("", data.field, function (res) {
                    layer.close(loading);
                    if (res.code > 0) {
                        layer.msg(res.msg, {time: 1800, icon: 1}, function () {
                            location.href = res.url;
                        });
                    } else {
                        layer.msg(res.msg, {time: 1800, icon: 2});
                    }
                });
            })
        });
    });

    //$(".leverxf").find("option[value='{$level}']").prop("selected",true);
    layui.form.render('select');

    form.render();

</script>
</body>
</html>